﻿<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" import="java.util.*" %>
<%String path = request.getContextPath(); %> 
<!DOCTYPE html>
<html>
<head>
<title>我的学习历史</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<link href="<%=path%>/resources/css/pages/style.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/resources/css/pages/xcConfirm.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/resources/script/js/jquery-1.8.0.min.js" ></script>
<script src="<%=path%>/resources/script/js/vue.js"></script>
<script type="text/javascript" src="<%=path%>/resources/script/js/js.js" ></script>
<script type="text/javascript" src="<%=path%>/resources/script/js/datechoose.js" ></script>
<script type="text/javascript" src="<%=path%>/resources/script/js/xcConfirm.js" ></script>
</head>
<body onload="initial()">
<div id="contentBody">
	<div class="top">
		<div class="top-ct">
	 	<h3 class="logo"></h3> 
	    <span id='span'>
	       <a href="<%=path%>/pages/login" id='plogin'><span >您好，请登录！</span></a>
	       <a href="<%=path%>/pages/userInfo?userid=${loginUser.id}" id='pshow'><span>${loginUser.nickName}（${loginUser.account }）</span></a>
	    </span>
		<p>
			<a href="<%=path%>/index">首页</a>
			<a href="<%=path%>/pages/mycourse?userid=${loginUser.id}">我的课程</a>
			<a href="javascript:void(0);" class="select">学习历史</a>
			<a href="javascript:void(0);">我的技能</a>
		</p>
		</div>
		</div>
	<div id="main">
		<div class="position">
				<a href="<%=path%>/index" class="syx">首页</a> >
				<a href="javascript:void(0);">学习历史</a>
			</div>
		<div class="history">
				<div class="h-left">
					<div class="rl">
						<CENTER>
<FORM name=CLD>
<TABLE>
  <TR>
    <TD align='middle'>
      <TABLE border="1px" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolor="#ffffff" bordercolorlight="#EEEEEE">
        <TR>
          <TD  style="padding-bottom:5pt" colSpan='7'><FONT style="FONT-SIZE: 14px">
            <SELECT id="SY" name='SY' onchange='changeCld()' style="FONT-SIZE: 14px;margin-left:30pt"> 
            <SCRIPT language="JavaScript">
                for(i=1990;i<2030;i++) document.write('<option>'+i);
            </SCRIPT>
            </SELECT> 年 <SELECT id="SM" name=SM onchange='changeCld()' style="FONT-SIZE: 13px"> 
            <SCRIPT language="JavaScript">
                for(i=1;i<13;i++) document.write('<option>'+i);
            </SCRIPT>
            </SELECT> 月 </FONT> <FONT color=#ffffff  id=GZ style="FONT-SIZE: 13px"></FONT><BR></TD>
        </TR>
        <TR align=middle style="border-top:2pt solid #999;border-bottom:1pt solid #CCC ">
          <TD width=54 style="font-size:9pt; padding-top:5pt;padding-bottom:5pt;">日</TD>
          <TD width=54 style="font-size:9pt ">一</TD>
          <TD width=54 style="font-size:9pt ">二</TD>
          <TD width=54 style="font-size:9pt ">三</TD>
          <TD width=54 style="font-size:9pt ">四</TD>
          <TD width=54 style="font-size:9pt ">五</TD>
          <TD width=54 style="font-size:9pt ">六</TD></TR>
          <SCRIPT language="JavaScript">
            var gNum;
            for(i=0;i<6;i++) {
               document.write('<tr align=center>');
               for(j=0;j<7;j++) {
                  gNum = i*7+j;
                  document.write('<td onclick=gethistory(this) id="GD' + gNum +'"><font id="SD' + gNum +'" size=2 face="Arial Black"');
                  if(j == 0) document.write(' color=red');if(j == 6) document.write(' color=#000080');
                  document.write(' TITLE=""> </font><br><font id="LD' + gNum + '" size=2 style="font-size:9pt"> </font></td>');
               }
               document.write('</tr>');
            }
           </SCRIPT>
        </TABLE>
</TD>
  </TR>
</TABLE>
</FORM>
</CENTER>
	</div>
	<div class="zj">
		<h3> 本日小结：</h3>
		<p>共学习：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> 发言：&nbsp;&nbsp;次
		</p>
	</div>

		</div>
		<div class="h-right">
			<div class="xxlc" v-for="item in historyList">
				<span>{{item.startTime}}</span>
				<div v-if="(item.flag=='create')">
				    <strong >开始 :</strong>
				    <a href="#" class="titleks">{{item.subjectName}}</a>
					<p>
						 <a>{{item.chapterName}}&nbsp;{{item.sectionName}}</a>
					</p>
				</div>
				<div v-if="(item.flag=='end')">
				    <strong >学习结束 :</strong>
				    <a href="#" class="titlejs"></a>
					<p></p>
				</div>
				<div v-if="(item.flag=='pinglun')">
				    <strong>评论 :</strong>
					<a href="javascript:void(0);" class="titlepl">{{item.g":"end"}}</a>
					<p></p>
				</div>
			</div>
			<div style="min-height:150px;height:auto;padding-top:30px;text-align:center;color:#777;font-size:18px"  v-if="historyList.length==0">
			    未找到历史学习记录
			</div>
<!-- 			<div class="xxlc"> -->
<!-- 				<span>20:13</span> -->
<!-- 				<strong>开始 :</strong> -->
<!-- 				<a href="#" class="titleks">《大学一年级思修》</a> -->
<!-- 				<p> -->
<!-- 					 <a>第一章 第三节 学习"思想道德修养与法律基础"课的意义和方法11111111111111111111111111111111111111111111111111111111111111</a> -->
<!-- 				</p> -->

<!-- 			</div> -->
<!-- 			<div class="xxlc"> -->
<!-- 				<span>20:25</span> -->
<!-- 				<strong>评论 :</strong> -->
<!-- 				<a href="#" class="titlepl">不就是学习嘛！高高高！！！</a> -->
<!-- 				<p></p> -->
<!-- 			</div> -->
<!-- 			<div class="xxlc"> -->
<!-- 				<span>20:30</span> -->
<!-- 				<strong>学习结束 :</strong> -->
<!-- 				<a href="#" class="titlejs"></a> -->
<!-- 				<p></p> -->
<!-- 			</div> -->
<!-- 			<div class="xx-mid"> -->
<!-- 			</div> -->
<!-- 			<div class="xxlc"> -->
<!-- 				<span>20:13</span> -->
<!-- 				<strong>开始 :</strong> -->
<!-- 				<a href="#" class="titleks">《大学一年级思修》</a> -->
<!-- 				<p> -->
<!-- 					<a href="#">第一章 第三节 学习"思想道德修养与法律基础"课的意义和方法</a> -->
<!-- 				</p> -->

<!-- 			</div> -->
<!-- 			<div class="xxlc"> -->
<!-- 				<span>20:25</span> -->
<!-- 				<strong>评论 :</strong> -->
<!-- 				<a href="#" class="titlepl">不就是学习嘛！高高高！！！</a> -->
<!-- 				<p></p> -->

<!-- 			</div> -->
			<div class="xx-last" v-if="historyList.length>0">
				<span></span>
				<strong>学习结束 :</strong>
				<a href="#"></a>
				<p></p>
			</div>

		</div>

	</div>
	</div>
		<div class="clear"></div>

		<div class="foot">
			<div class="foot-top"></div>
			<div class="foot-ct">
				<p>Copyright © 2016 业主单位：福建工程学院，建设单位：福州森泽信息科技有限公司 技术服务热线：87862229

					<a href="#"><img src="<%=path%>/resources/images/pages/images/cnzz.jpg"></a>
				</p>
			</div>

		</div>
</div>
<script>
var vmMain = new Vue({
    el: '#contentBody',
    data: {
        historyList: []
    },
    methods:{
    	
    }
});
 $(function () {
    
    var toDate=new Date();
    var year=toDate.getFullYear().toString();
    var month=toDate.getMonth()>8?(toDate.getMonth()+1).toString():("0"+(toDate.getMonth()+1).toString());
    var day=toDate.getDate()>8?toDate.getDate().toString():("0"+toDate.getDate().toString());
    var dateStr=year+"-"+month+"-"+day;
    $.ajax({
	        type: "post",
	        url: "findStudyHistory",
	        dataType: "json",
	        data: { date: dateStr},
	        success: function (result) {
	        	for(var i=0;i<result.length;i++)
	        	{
	        		result[i].startTime=result[i].recordTime.substring(11,16);
	        	}
	        	vmMain.historyList=result;
	        },
	        error: function () {
	            return;
	        }
	     });
});
 
 function gethistory(obj){
	 var day=obj.children[0].innerText;
	 if(day!=""&&day!=undefined){
		 var year=$("#SY").val();
		 var month=$("#SM").val().toString();
		 if(year==""||year==undefined||month==""||month==undefined)
		 {
			 window.wxc.xcConfirm("请先选择年月", window.wxc.xcConfirm.typeEnum.info,{
					onOk:function(){
						
					}
				});
		 }
		 else
		 {
			 var year=year.toString();
			 var mm=month>9?month.toString():("0"+month.toString());
			 var dd=day.trim().length==1?("0"+day):day
		     var dateStr=year+"-"+mm+"-"+dd;
		     if('${loginUser.id}'=="")
	    	 {
		    	 window.wxc.xcConfirm("请先登录", window.wxc.xcConfirm.typeEnum.info,{
						onOk:function(){
							location.href = '<%=path%>/pages/login';
						}
					});
		    	 return false;
	    	 }
		     else{
			    	 $.ajax({
			    	        type: "post",
			    	        url: "findStudyHistory",
			    	        dataType: "json",
			    	        data: { date: dateStr},
			    	        success: function (result) {
			    	        	for(var i=0;i<result.length;i++)
			    	        	{
			    	        		result[i].startTime=result[i].recordTime.substring(11,16);
			    	        	}
			    	        	vmMain.historyList=result;
			    	        },
			    	        error: function () {
			    	            return;
			    	        }
			    	     });
		     }
		 } 
	 }
}

</script>
<script type="text/javascript"  language="JavaScript">
$(function(){
	var myName='${loginUser.account}';
	if(myName==""||myName==undefined)
	{
		document.getElementById('plogin').setAttribute("style", "display:inline");
		document.getElementById('pshow').setAttribute("style", "display:none");
	}
	else{
		document.getElementById('plogin').setAttribute("style", "display:none");
		document.getElementById('pshow').setAttribute("style", "display:inline");
	}
});
</script>
</body>

</html>